﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterAdmin.master" AutoEventWireup="true" CodeBehind="Sender_Product.aspx.cs" Inherits="UdrinkWater_Project.Admin.Sender_Product" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <dx:ASPxRoundPanel ID="ASPxRoundPanel1" runat="server" 
        HeaderText="รายการสินค้าที่ยังไม่จัดส่ง" Width="100%">
        <HeaderStyle Font-Size="Medium" HorizontalAlign="Left" />
        <PanelCollection>
<dx:PanelContent runat="server" SupportsDisabledAttribute="True">
    <table class="dxflInternalEditorTable">
        <tr>
            <td>
                <dx:ASPxButton ID="bt_ConfirmSender" runat="server" 
                    OnClick="bt_ConfirmSender_Click" Text="ยืนยันการทำรายการส่งสินค้า" 
                    UseSubmitBehavior="False" Width="120px" Visible="False">
                    <ClientSideEvents Click="function(s, e) {
	e.processOnServer = confirm('ยืนยันการทำรายการส่งสินค้า');
}" />
                </dx:ASPxButton>
            </td>
            <td align="right">
                <dx:ASPxButton ID="ASPxButton1" runat="server" Height="37px" 
                    OnClick="ASPxButton1_Click" Text="พิมพ์รายการจัดส่ง" UseSubmitBehavior="False" 
                    Width="120px">
                </dx:ASPxButton>
            </td>
        </tr>
    </table>
    <dx:ASPxGridView ID="GV_Sender" runat="server" AutoGenerateColumns="False" 
        DataSourceID="SqlData_Sender" KeyFieldName="Order_Date" Width="100%">
        <Columns>
            <dx:GridViewCommandColumn ShowInCustomizationForm="True" VisibleIndex="0" 
                Caption="ค้นหา" Width="30px">
                <ClearFilterButton Visible="True">
                </ClearFilterButton>
            </dx:GridViewCommandColumn>
            <dx:GridViewDataDateColumn Caption="เลขที่ใบรายการ" FieldName="Order_Date" 
                ReadOnly="True" ShowInCustomizationForm="True" VisibleIndex="1" 
                Width="180px">
                <PropertiesDateEdit DisplayFormatString="yyyy-MM-dd HH:mm:ss.fff" 
                    EditFormat="Custom">
                </PropertiesDateEdit>
                <Settings AllowAutoFilter="False" />
            </dx:GridViewDataDateColumn>
            <dx:GridViewDataTextColumn FieldName="Customer_ID" 
                ShowInCustomizationForm="True" VisibleIndex="2" Caption="ชื่อลูกค้า" 
                Width="150px">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataDateColumn FieldName="Shipped_date" 
                ShowInCustomizationForm="True" VisibleIndex="3" Caption="วันกำหนดส่ง" 
                Width="100px">
                <PropertiesDateEdit DisplayFormatString="dd MMMM yyyy">
                </PropertiesDateEdit>
            </dx:GridViewDataDateColumn>
            <dx:GridViewDataTextColumn FieldName="Delivery_Address" 
                ShowInCustomizationForm="True" VisibleIndex="4" Caption="ที่อยู่การจัดส่ง">
                <Settings AllowAutoFilter="False" />
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataCheckColumn Caption="สถานะการจัดส่ง" FieldName="Status" 
                ShowInCustomizationForm="True" VisibleIndex="5" Width="50px" 
                Visible="False">
                <PropertiesCheckEdit DisplayTextChecked="จัดส่งเรียบร้อยแล้ว" 
                    DisplayTextUnchecked="รอการจัดส่ง" ValueChecked="2" ValueType="System.Int32" 
                    ValueUnchecked="1">
                </PropertiesCheckEdit>
            </dx:GridViewDataCheckColumn>
            <dx:GridViewDataTextColumn Caption="พนักงานจัดส่ง" FieldName="Employee_ID" 
                ShowInCustomizationForm="True" VisibleIndex="6" Visible="False">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataComboBoxColumn Caption="สถานะการชำระเงิน" 
                FieldName="Status_Unpaid" ShowInCustomizationForm="True" VisibleIndex="7" 
                Width="80px" Visible="False">
                <PropertiesComboBox DataSourceID="SqlData_Unpaid" TextField="Unpaid_Name" 
                    ValueField="Unpaid_ID" ValueType="System.Int32">
                </PropertiesComboBox>
            </dx:GridViewDataComboBoxColumn>
            <dx:GridViewDataTextColumn ShowInCustomizationForm="True" VisibleIndex="8" 
                Width="120px" Visible="False">
                <DataItemTemplate>
                    <dx:ASPxCheckBox ID="CheckBox1" runat="server" ForeColor="#80A70E" 
                        Text="ยืนยันการส่งสินค้า">
                    </dx:ASPxCheckBox>
                </DataItemTemplate>
            </dx:GridViewDataTextColumn>
        </Columns>
        <SettingsPager NumericButtonCount="14" PageSize="14">
        </SettingsPager>
        <Settings ShowFilterRow="True" />
        <SettingsDetail ShowDetailRow="True" />
        <Templates>
            <DetailRow>
                <dx:ASPxGridView ID="GV_OrderList" runat="server" AutoGenerateColumns="False" 
                    DataSourceID="SqlData_Orderlist" 
                    onbeforeperformdataselect="detailGrid_DataSelect" Width="100%" 
                    oncustomunboundcolumndata="GV_OrderList_CustomUnboundColumnData">
                    <TotalSummary>
                        <dx:ASPxSummaryItem DisplayFormat="ราคารวม {0:#,###.00}" FieldName="Total" 
                            SummaryType="Sum" />
                    </TotalSummary>
                    <Columns>
                        <dx:GridViewDataDateColumn FieldName="Order_Date" VisibleIndex="0" 
                            Caption="เลขที่ใบรายการ" Visible="False">
                        </dx:GridViewDataDateColumn>
                        <dx:GridViewDataComboBoxColumn Caption="รายการสินค้า" FieldName="Product_ID" 
                            VisibleIndex="1">
                            <PropertiesComboBox DataSourceID="SqlData_Product" TextField="Product_name" 
                                ValueField="Product_ID">
                            </PropertiesComboBox>
                        </dx:GridViewDataComboBoxColumn>
                        <dx:GridViewDataTextColumn FieldName="Product_Count" VisibleIndex="2" 
                            Caption="จำนวน">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Price" VisibleIndex="3" Caption="ราคา">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Discount" VisibleIndex="4" 
                            Caption="ส่วนลด">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn Caption="ราคาสุทธิ" FieldName="Total" 
                            UnboundType="Integer" VisibleIndex="5">
                            <PropertiesTextEdit DisplayFormatString="c">
                            </PropertiesTextEdit>
                        </dx:GridViewDataTextColumn>
                    </Columns>
                    <SettingsPager Mode="ShowAllRecords">
                    </SettingsPager>
                    <Settings ShowFooter="True" />
                </dx:ASPxGridView>
                <asp:SqlDataSource ID="SqlData_Orderlist" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
                    SelectCommand="SELECT Order_Date, Product_ID, Product_Count, Price, Discount FROM TB_Orderlist WHERE (Order_Date = @Order_Date)">
                    <SelectParameters>
                        <asp:SessionParameter Name="Order_Date" SessionField="Order_Date" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </DetailRow>
        </Templates>
    </dx:ASPxGridView>
    <asp:SqlDataSource ID="SqlData_Sender" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
        
        SelectCommand="SELECT [Order_Date], [Customer_ID], [Shipped_date], [Delivery_Address], [Status], [Employee_ID], [Status_Unpaid] FROM [TB_Order] WHERE ([Status] = @Status)">
        <SelectParameters>
            <asp:Parameter DefaultValue="1" Name="Status" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlData_Unpaid" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
        SelectCommand="SELECT * FROM [TB_StatusUnpaid]"></asp:SqlDataSource>
            <asp:SqlDataSource ID="SqlData_Product" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
        SelectCommand="SELECT [Product_name], [Product_ID] FROM [TB_Product]">
    </asp:SqlDataSource>
            <dx:ASPxGridViewExporter ID="ASPxGridViewExporter1" runat="server" 
        GridViewID="GV_Sender">
                <Styles>
                    <Header Font-Names="Angsana New">
                    </Header>
                    <Cell Font-Names="Angsana New">
                        <Paddings PaddingLeft="40px" PaddingRight="40px" />
                    </Cell>
                    <Footer Font-Names="Angsana New">
                    </Footer>
                    <Title Font-Names="Angsana New"></Title>
                </Styles>
                <PageHeader Center="รายการสินค้าที่ยังไม่จัดส่ง">
                    <Font Names="Angsana New"></Font>
                </PageHeader>
    </dx:ASPxGridViewExporter>
            </dx:PanelContent>
</PanelCollection>
    </dx:ASPxRoundPanel>
</asp:Content>
